match block not needed
authorTshepang Lekhonkhobe <tshepang@gmail.com>
Thu, 18 Aug 2016 06:46:42 +0000 (08:46 +0200)
committerTshepang Lekhonkhobe <tshepang@gmail.com>
Thu, 18 Aug 2016 06:47:10 +0000 (08:47 +0200)
src/cargo/ops/cargo_doc.rs

index 2ce18102a1b7b70b43431d82a0dfdce289bdf67b..f89dfac78f84f87271fca677527fcc607f2e1b82 100644 (file)
@@ -82,12 +82,11 @@ fn open_docs(path: &Path) -> Result<&'static str, Vec<&'static str>> {
     use std::env;
     let mut methods = Vec::new();
     // trying $BROWSER
-    match env::var("BROWSER"){
-        Ok(name) => match Command::new(name).arg(path).status() {
+    if let Ok(name) = env::var("BROWSER") {
+        match Command::new(name).arg(path).status() {
             Ok(_) => return Ok("$BROWSER"),
             Err(_) => methods.push("$BROWSER")
-        },
-        Err(_) => () // Do nothing here if $BROWSER is not found
+        }
     }
 
     for m in ["xdg-open", "gnome-open", "kde-open"].iter() {